@extends('layouts.app')

@section('content')
    <div class="row">
        <div class="col-xs-12">
            <!-- BEGIN PAGE HEADER -->
            <h3 class="page-title pull-left">
                管理员列表
            </h3>

            <a href="/admin/admins/create" class="btn btn-primary pull-right">新建管理员</a>
            <!-- END PAGE HEADER -->
        </div>

        <div class="col-xs-12">
            <!-- BEGIN PAGE CONTENT-->
            {{-- add `has-show-view` class to enable click to redirect `show view` action --}}
            <table class="table table-striped table-bordered">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>@lang('t.name')</th>
                        <th>@lang('t.email')</th>
                        <th style="width: 50%;">@lang('t.permission')</th>
                        <th style="width: 105px">操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($admins as $admin)
                        <tr data-id="{{ $admin->id }}"
                            data-url="/admin/admins/{{ $admin->id }}">
                            <td>{{ $loop->iteration }}</td>
                            <td>{{ $admin->name }}</td>
                            <td>{{ $admin->email }}</td>
                            <td>
                                @foreach($admin->permissions as $permission)
                                    <span>{{ $permission->description }}</span>
                                @endforeach
                            </td>
                            <td class="text-center">
                                <a href="/admin/admins/{{ $admin->id }}/edit"
                                   class="btn btn-primary btn-xs btn-edit">编辑</a>
                                <button class="btn btn-danger btn-xs btn-delete">删除</button>
                            </td>
                        </tr>
                    @endforeach
                </tbody>
            </table>
            <!-- END PAGE CONTENT-->
        </div>
    </div>
@endsection

